import axios from "axios";

// axios.create() a single axios instance for the entire app
const apiClient = axios.create({
  baseURL:
    "https://koa-monitorrver-koa-dxsjkmwnnu.cn-hangzhou.fcapp.run/api/web",
  withCredentials: false,
  headers: {
    Accept: "application/json",
    "Conetent-Type": "application/json",
  },
  timeout: 15000,
});

export default {
  getBlogs() {
    return apiClient.get("/getBlogs");
  },
  getBlog(id) {
    return apiClient.get("/getBlog?id=" + id);
  },
  postBlog(blogpost) {
    return apiClient.post("/postBlog", blogpost);
  },
  deleteBlog(id) {
    return apiClient.delete("/deleteBlog/" + id);
  },
  // 写法可能有问题，不能直接把data写在外面
};
